package cn.bdqn.service.impl;

import cn.bdqn.mapper.ActivityMapper;
import cn.bdqn.pojo.Activity;
import cn.bdqn.service.ActivityService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class ActivityServiceImpl implements ActivityService {
    @Resource
    private ActivityMapper activityMapper;
    @Override
    public List<Activity> getActivityByCustNo(String custNo) {
        QueryWrapper<Activity> qw = new QueryWrapper<>();
        qw.eq("atv_cust_no", custNo);
        return activityMapper.selectList(qw);
    }

    @Override
    public void addActivity(Activity activity) {
        activityMapper.insert(activity);
    }

    @Override
    public Activity getActivity(Long id) {
        return activityMapper.selectById(id);
    }

    @Override
    public void updateActivity(Activity activity) {
        activityMapper.updateById(activity);
    }

    @Override
    public void deleteActivity(Long id) {
        activityMapper.deleteById(id);
    }
}
